package cn.yy.mobile_erp.controller.user;

import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import cn.yy.mobile_erp.controller.BaseController;
import cn.yy.mobile_erp.pojo.User;
import cn.yy.mobile_erp.service.UserService;
import cn.yy.mobile_erp.tool.Constants;

import com.alibaba.fastjson.JSONArray;
import com.mysql.jdbc.StringUtils;



@Controller
@RequestMapping("/sys/user")
public class UserController extends BaseController{

	//private Logger log=Logger.getLogger(UserController.class);
	
	@Resource
	private UserService userService;
	
	
	
	
	@RequestMapping(value="/index.html" )
	public String index(Model model,@RequestParam(value="id",required=false) String id){
		System.out.println(id+"-_________----");
		User user =null;
		Integer id1=Integer.valueOf(id);
		try {
			user=userService.getUserById(id1);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		model.addAttribute("user", user);
		return "index";
	}
}
